import Vue from 'vue'
const host = process.env.API_HOST

export const changeState = (state = '', srcMac = '') => {
  return Vue.http.put(`${host}/web/park/state`, { state, srcMac } )
}

export const projectCount = (state = '', type = '', fuzzy = '', recommenderType = '', sctime = '', ectime = '', openid = '') => {
  return Vue.http.get(`${host}/web/park/count`, { params: { state, type, fuzzy, recommenderType, sctime, ectime, openid } })
}

export const projectList = (page, pageSize, state = '', type = '', fuzzy = '', recommenderType = '', sctime = '', ectime = '', openid = '') => {
  return Vue.http.get(`${host}/web/park/list`, { params: { page, pageSize, state, type, fuzzy, recommenderType, sctime, ectime, openid } })
}

// export const selectProCount = (fuzzy = '') => {
//   return Vue.http.get(`${host}/m/project/select/count`, { params: { fuzzy } })
// }

// export const selectProList = (fuzzy = '', page = 1, pageSize = 10) => {
//   return Vue.http.get(`${host}/m/project/select/list`, { params: { fuzzy, page, pageSize } })
// }


export const addProject = (form) => {
  return Vue.http.post(`${host}/web/park`, form)
}

export const updateProject = (id,form) => {
  return Vue.http.put(`${host}/web/park/${id}`, form)
}

export const getProject = id => {
  return Vue.http.get(`${host}/web/park/${id}`)
}

export const RecordCount = (fuzzy, sctime, ectime) => {
  return Vue.http.get(`${host}/web/parkrecord/count`,{ params: { fuzzy, sctime, ectime } })
}

export const RecordList = (page, pageSize, fuzzy, sctime, ectime) => {
  return Vue.http.get(`${host}/web/parkrecord/list`,{ params: { page, pageSize, fuzzy, sctime, ectime } })
}

export const payCount = (fuzzy, sctime, ectime) => {
  return Vue.http.get(`${host}/web/payrecord/count`,{ params: { fuzzy, sctime, ectime } })
}

export const payList = (page, pageSize, fuzzy, sctime, ectime) => {
  return Vue.http.get(`${host}/web/payrecord/list`,{ params: { page, pageSize, fuzzy, sctime, ectime } })
}
// export const passAudit = id => {
//   return Vue.http.put(`${host}/m/project/${id}/passAudit`)
// }

// export const noPassAudit = id => {
//   return Vue.http.put(`${host}/m/project/${id}/noPassAudit`)
// }

// export const stop = id => {
//   return Vue.http.put(`${host}/m/project/${id}/stop`)
// }

// export const restore = id => {
//   return Vue.http.put(`${host}/m/project/${id}/restore`)
// }

// export const end = id => {
//   return Vue.http.put(`${host}/m/project/${id}/end`)
// }

// export const refund = id => {
//   return Vue.http.put(`${host}/m/project/${id}/refund`)
// }

// export const refunding = (id, form) => {
//   return Vue.http.put(`${host}/m/project/${id}/refunding`, form)
// }
